<template>
  <div class="home-swiper">
    <swiper :options="swiperOption">
    <!-- slides -->
      <swiper-slide v-for="item in list" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl" alt="去哪儿">
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        autoplay: 2000,
        pagination: '.swiper-pagination',
        loop: true
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
// scoped限制了样式作用域，需要使用穿透 >>>
.home-swiper >>> .swiper-pagination-bullet-active
  background #fff
.home-swiper
  overflow hidden
  width 100%
  height 0
  padding-bottom 31.25%
  background #f1f1f1
  .swiper-img
    width 100%
</style>
